/* eslint-disable */
function toCamelCase(name) {
  var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
  var MOZ_HACK_REGEXP = /^moz([A-Z])/;
  var ret = name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
    return offset ? letter.toUpperCase() : letter;
  }).replace(MOZ_HACK_REGEXP, "Moz$1");
  return ret.slice(0, 1).toUpperCase() + ret.slice(1);
} // 转中划线


function hyphenate(str) {
  return str.replace(/\B([A-Z])/g, "-$1").toLowerCase();
} // const getStyle = (name) => name.startsWith('@') ? false : `${name}/style`


var getStyle = function getStyle(name, lib, targetLib) {
  var originName = hyphenate(name.replace("@cpaas-front-ui/".concat(lib, "/lib/"), ""));
  return name.startsWith("@") ? "".concat(targetLib, "/lib/").concat(originName, "/style") : "".concat(name, "/style");
};

var cpaasComponents = ["progress", "input-number", "input", "date-picker", "slider", "time-picker", "checkbox", "spin", "table"];
var c7nComponents = ["slider", "spin", "progress", "table"];
var c7nProComponents = ["progress", "range", "form", "table"
/* "pagination" */
];
module.exports = {
  cpaasComponents: cpaasComponents,
  c7nProComponents: c7nProComponents,
  c7nComponents: c7nComponents,
  generateCpaasUIConfig: function generateCpaasUIConfig() {
    return [["import", {
      libraryName: "cpaas-ui",
      customName: function customName(name) {
        return cpaasComponents.includes(name) ? "antd/lib/" + name : "antd/lib/" + name;
      },
      style: process.env.NODE_ENV === "production" ? false : function (name) {
        return getStyle(name, "cpaas-ui", "cpaas-ui");
      }
    }, "ant"]];
  },
  generateC7nUiConfig: function generateC7nUiConfig() {
    return [["import", {
      libraryName: "choerodon-ui",
      customName: function customName(name) {
        return "choerodon-ui/lib/" + name;
      },
      style: process.env.NODE_ENV === "production" ? false : function (name) {
        return getStyle(name, "c7n-ui", "choerodon-ui");
      }
    }, "c7n"], ["import", {
      libraryName: "choerodon-ui/pro",
      customName: function customName(name) {
        return "choerodon-ui/pro/lib/" + name;
      },
      style: process.env.NODE_ENV === "production" ? false : function (name) {
        var originName = hyphenate(name.replace("choerodon-ui/lib/", "")).replace("-pro", "");
        return name.startsWith("@") ? "choerodon-ui/pro/lib/".concat(originName, "/style") : "".concat(name, "/style");
      }
    }, "c7n-pro"]];
  }
};
